package com.yysjyr.logisticssystem.workbench.controller;

import com.yysjyr.logisticssystem.common.contants.Contants;
import com.yysjyr.logisticssystem.settings.entity.User;
import jakarta.servlet.http.HttpSession;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RequestMapping("/workbench/")
@RestController("index2")
public class IndexController {

    @RequestMapping("toIndex")
    public ModelAndView toIndex(HttpSession session, Model model) {
        User user = (User)session.getAttribute(Contants.SESSION_USER);
        model.addAttribute("user",user);
        String index = "";
        index = user.getType().equals("ba7ec24cd3db40e0b77b57a896c6b258")?"client": "emp";
        return new ModelAndView("/pages/workbench/index/"+index+".html");
    }
}
